﻿using DomainService.IService.Sys;
using DomainService.Service.Sys;
using Microsoft.AspNetCore.Mvc;
using Model.BusinessModel.OutPut;
using Model.BusinessModel.OutPut.sys;
using Model.DomainModel.Sys;
using Utility;
using Utility.Enum;

namespace OverallAuth_WebApi.Controllers.Sys
{
    /// <summary>
    /// Sys_ButtonStyle 按钮样式
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    [ApiExplorerSettings(GroupName = nameof(ModeuleGroupEnum.SysButtonStyle))]
    public class SysButtonStyleController : BaseController
    {
        #region 构造实列化

        /// <summary>
        /// 按钮样式服务
        /// </summary>
        public ISysButtonStyleService _sysButtonStyleService;

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="sysButtonStyleService"></param>
        public SysButtonStyleController(ISysButtonStyleService sysButtonStyleService)
        {
            _sysButtonStyleService = sysButtonStyleService;
        }

        #endregion

        #region 接口

        /// <summary>
        /// 添加按钮样式信息
        /// </summary>
        /// <param name="sysButtonStyle"></param>
        /// <returns></returns>
        [HttpPost]
        public ReceiveStatus AddButtonStyleMsg(SysButtonStyle sysButtonStyle)
        {
            sysButtonStyle.CreateTime = DateTime.Now;
            sysButtonStyle.CreateUser = GetLoginUserMsg().UserId.ToString();
            return _sysButtonStyleService.Insert(sysButtonStyle);
        }

        /// <summary>
        /// 修改按钮样式信息
        /// </summary>
        /// <param name="sysButtonStyle"></param>
        /// <returns></returns>
        [HttpPost]
        public ReceiveStatus UpdateButtonStyleMsg(SysButtonStyle sysButtonStyle)
        {
            sysButtonStyle.CreateTime = DateTime.Now;
            sysButtonStyle.CreateUser = GetLoginUserMsg().UserId.ToString();
            return _sysButtonStyleService.Update(sysButtonStyle);
        }

        /// <summary>
        /// 删除按钮样式信息
        /// </summary>
        /// <param name="buttonStyleId"></param>
        /// <returns></returns>
        [HttpDelete]
        public ReceiveStatus DeleteButtonStyleMsg(string buttonStyleId)
        {
            return _sysButtonStyleService.Delete(buttonStyleId);
        }

        /// <summary>
        /// 获取按钮样式数据
        /// </summary>
        /// <returns>返回按钮样式数据</returns>
        [HttpGet]
        public ReceiveStatus<SysButtonStyleOutPut> GetButtonStyleList()
        {
            ReceiveStatus<SysButtonStyleOutPut> receiveStatus = new();
            var list = _sysButtonStyleService.GetButtonStyleList();
            receiveStatus.data = list;
            return receiveStatus;
        }

        /// <summary>
        /// 获取所有按钮样式,select结构
        /// </summary>
        /// <returns>以select结构，返回所有按钮样式</returns>
        [HttpGet]
        public ReceiveStatus<SelectOutPut> GetButtonSelect()
        {
            ReceiveStatus<SelectOutPut> receiveStatus = new();
            var list = _sysButtonStyleService.GetButtonSelect();
            receiveStatus.data = list;
            return receiveStatus;
        }
        #endregion
    }
}
